﻿using DocumentFormat.OpenXml.Lite.Xml;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml.Schema;
using System.Xml.Serialization;

namespace DocumentFormat.OpenXml.Lite.SpreadsheetML.Excel.StyleElements
{
    [XmlRoot("dxfs", Namespace = Constants.ExcelMain)]
    public class Formats : XmlSerializable
    {
        [Optional]
        [XmlAttribute("count", Form = XmlSchemaForm.Qualified)]
        public Nullable<uint> Count { get; set; }

        [XmlElement("dxf", Namespace = Constants.ExcelMain)]
        public XmlList<Formatting> FormattingElements { get; set; }

        public Formats()
        {
            FormattingElements = new XmlList<Formatting>();
        }

        public void AddElement(Formatting element)
        {
            if (Count == null)
            {
                Count = 0;
            }

            Count++;
            FormattingElements.Add(element);
        }
    }
}
